Skip to content

Conversation

pkgw
Copy link
Contributor

@pkgw pkgw commented Jan 2, 2013

The Sha1 API takes the data to be hashed as &[u8]. This patch changes the type to &[const u8]. I'm not well-versed in the const semantics of Rust, but I imagine this is a reasonable thing to do, and this change makes the API compatible with to_bytes::IterBytes, which returns data in chunks of type &[const u8].

After making this change, 'make check' reports no failures for me.

(By the way, is there a reason for the double parentheses around the function argument lists in the Sha1 trait?)

We are of course never going to modify the data, and this change allows us to
accept data from to_bytes::IterBytes types.
@catamorphism
Copy link
Contributor

Roughly, const means "code taking an argument of this type can't rely either on knowing it's mutable, or knowing it's immutable".

@catamorphism
Copy link
Contributor

Not sure about those double parens, but I can't see why they would need to be there. I'll try removing them while testing this.

@catamorphism
Copy link
Contributor

Running try -- will merge when it's done. Thanks!

@ghost ghost assigned catamorphism Jan 2, 2013
@catamorphism
Copy link
Contributor

Merged, thanks!

RalfJung added a commit to RalfJung/rust that referenced this pull request May 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants